home *** CD-ROM | disk | FTP | other *** search
/ MacFormat 1994 September / macformat-004.iso / Shareware City / Graphics / VideoToolbox ƒ / VideoToolboxSources / Zoom.c < prev   
Encoding:
C/C++ Source or Header  |  1994-07-07  |  1.6 KB  |  43 lines  |  [TEXT/KAHL]

  1. /*
  2. Zoom.c 
  3. 10/17/90    dgp    translated from pascal DoWZoom.p in Inside Mac VI.
  4. 10/18/90 dgp    removed part of the code to make GetWindowDevice(), which I put
  5.                 in GetScreenDevice.c
  6. 8/24/91    dgp        Made compatible with THINK C 5.0.
  7. 12/27/91 dgp    Extracted code to create TitleBarHeight.c
  8. 3/26/92    dgp        Replaced use of SysEnvirons() by a call to QD8Exists().
  9. 6/3/94    dgp    replaced low-memory global MBarHeight by GetMBarHeight().
  10. 6/12/94    dgp    changed "theEvent" from a global to an argument "event", passed by address.
  11. */
  12. #include "VideoToolbox.h"
  13.  
  14. void Zoom(WindowPtr theWindow,int zoomDir,EventRecord *event)
  15. {
  16.     Rect r;
  17.     GDHandle dominantGDevice;
  18.     int headRoom;
  19.     GrafPtr savePort;
  20.     
  21.     if(TrackBox(theWindow,event->where,zoomDir)){
  22.         GetPort(&savePort);
  23.         SetPort(theWindow);
  24.         EraseRect(&theWindow->portRect);        /*recommended for cosmetic reasons*/
  25.         /* If there is the possibility of multiple gDevices, then we */
  26.         /* must check them to make sure we are zooming onto the right */
  27.         /* display device when zooming out. */
  28.         if(zoomDir==inZoomOut && QD8Exists()){
  29.             headRoom=TitleBarHeight(theWindow);
  30.             /* We must create a zoom rectangle manually in this case. */
  31.             /* Account for menu bar height as well, if on main device */
  32.             dominantGDevice=GetWindowDevice(theWindow);
  33.             if(dominantGDevice==GetMainDevice()) headRoom += GetMBarHeight();
  34.             r=(*dominantGDevice)->gdRect;
  35.             SetRect(&r,r.left+3,r.top+headRoom+3,r.right-3,r.bottom-3);
  36.             /* Set up the WStateData record for this window. */
  37.             (*((WStateData **)((WindowPeek)theWindow)->dataHandle))->stdState = r;
  38.         }
  39.         ZoomWindow(theWindow,zoomDir,TRUE);
  40.         SetPort(savePort);
  41.     }
  42. }
  43.